package ua.com.globallogic.basecamp.krasnyanskiy.primenumbers;

import java.util.List;

public class PrimeNumberExample {
    public static void main(String[] args) throws Exception {

        int boundary;
        int threads;

        UserInput userInput =
                new UserInput(System.in).scan();

        boundary = userInput.getBoundary();
        threads = userInput.getThreads();


        /* calculates all prime numbers less then a boundary */
        List<Integer> primes =
                new PrimeNumber().
                        buildPrimes(threads, boundary).
                        withPrimesAmountPrint().
                        withTimePrint().
                        getResultAsList();

        System.out.println("Last prime number is: " +
                primes.get(primes.size()-1));
    }
}
